import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
//导入指令
import * as alldir from '@/directive'

//导入插件
import plugin from '@/utils/plugin'
//导入过滤器
import * as AllFileter from '@/fileter/index'
//导入打印插件
import Print from 'vue-print-nb'
Vue.use(Print)
//使用插件
Vue.use(plugin)
// console.log(Object.keys(AllFileter))
// console.log(AllFileter)
Object.keys(alldir).forEach(item => {
  Vue.directive(item, alldir[item])
})

Object.keys(AllFileter).forEach(item => {
  Vue.filter(item, AllFileter[item])
})

// Vue.directive('errimg', {
//   inserted:function(dom,options) {
//     dom.onerror=function () {
//       dom.src=options.value
//     }
//   }
// })
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
